%script{:src => "http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAA27JPTEzEsnofDQf1-zjmqRR1lxKQIC7fKYcsa4QwXlhD3l0ESBTm_eGhVhEGRdcIM3404_PAGbZ_TQ", :type => "text/javascript"}
#map{:onunload => "GUnload()"}
%script{:type => "text/javascript"}
  ="    //<![CDATA["
  ="    if (GBrowserIsCompatible()) {"
  ="      var geocoder;"
  ="      var map = new GMap2(document.getElementById(\"map\"));"
  =""
  ="      geocoder = new GClientGeocoder();"
  ="      map.addControl(new GLargeMapControl());"
  ="        map.addControl(new GMapTypeControl());"
  ="        map.setCenter(new GLatLng(" + ((@show.latitude && !@show.latitude.blank?) ? @show.latitude : "44.976705") + "," + ((@show.longitude && !@show.longitude.blank?) ? @show.longitude : "-85.210294") + "), " + ((@show.longitude && !@show.longitude.blank? && @show.latitude && !@show.latitude.blank?) ? "14" : "6") + ");"
  =""
  ="      function addToMap(point) {"
  ="        marker = new GMarker(point);"
  ="        map.addOverlay(marker);"
  ="      }"
  =""
  ="          var request = GXmlHttp.create();"
  ="          request.open(\"GET\", \"" + show_url(@show) + ".xml\", true);"
  =""
  ="          request.onreadystatechange = function() {"
  ="            if (request.readyState == 4) {"
  ="          var xmlDoc = GXml.parse(request.responseText);"
  ="          var markers = xmlDoc.documentElement.getElementsByTagName(\"marker\");"
  =""
  ="          for (var i = 0; i < markers.length; i++) {"
  ="            var location = markers[i].getAttribute(\"location\");"
  ="            var html = markers[i].getAttribute(\"html\");"
  ="            geocoder.getLatLng(location, addToMap);"
  ="          }"
  ="          }"
  ="          }"
  ="          request.send(null);"
  ="      }"
  ="      //]]>"